doctype html
html.no-focus lang="en"
  head
    title = @html_title || '登录项目管理系统'
    meta charset='utf-8'
    meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
    meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"
    meta name="renderer" content="webkit"
    meta http-equiv="cleartype" content="on"
    meta name="HandheldFriendly" content="True"
    meta name="MobileOptimized" content="320"
    - if content_for?(:title)
      = yield(:title)
    - else
      title Projects-Manager-System
    = csrf_meta_tags
    = action_cable_meta_tag
    = content_for?(:head) ? yield(:head) : ''
    = stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload'
    = javascript_include_tag 'application', 'data-turbolinks-track': 'reload'


  body
    .content.overflow-hidden
      .row
        .col-sm-8.col-sm-offset-2.col-md-6.col-md-offset-3.col-lg-4.col-lg-offset-4
          .block.block-themed.animated.fadeIn
            .block-header.bg-primary
              h3.block-title 登录系统
            .block-content.block-content-full.block-content-narrow
              / Login Title
              h1.h2.font-w600.push-30-t.push-5 项目管理系统
              small 欢迎, 请输入用户名密码登录系统.
              = simple_form_for(@user, :url => '/login', remote: true, :html=>{:id=>"login-form", :novalidate=>true, :class=>"js-validation-login form-horizontal push-30-t push-50"}) do |f|
                .form-group
                  .col-xs-12
                    .form-material.form-material-primary.floating
                      = f.input_field :login, :required => true, class: 'form-control', label: false, wrapper_html:false
                      label for="base_user_username" 请输入用户名
                .form-group
                  .col-xs-12
                    .form-material.form-material-primary.floating
                      = f.input_field :password, :required => true, class: 'form-control', label: false
                      label for= "base_user_password" 密码
                .form-group
                  .col-xs-12
                    label.css-input.switch.switch-sm.switch-primary
                      input#login-remember-me name="remember-me" type="checkbox"
                      span
                      | 记住登录
                    /a.pull-right href='/forgot' 忘记密码
                .form-group
                  .col-xs-12.col-sm-6.col-md-4
                    button.btn.btn-block.btn-primary type="submit"
                      i.si.si-login.pull-right
                      | 登录
    javascript:
      jQuery('.js-validation-login').validate({
        errorClass: 'help-block text-right animated fadeInDown',
        errorElement: 'div',
        errorPlacement: function (error, e) {
          jQuery(e).parents('.form-group > div').append(error);
        },
        highlight: function (e) {
          jQuery(e).closest('.form-group').removeClass('has-error').addClass('has-error');
          jQuery(e).closest('.help-block').remove();
        },
        success: function (e) {
          jQuery(e).closest('.form-group').removeClass('has-error');
          jQuery(e).closest('.help-block').remove();
        },
        rules: {
          'user[login]': {
            required: true
          },
          'user[password]': {
            required: true,
            minlength: 5
          }
        },
        messages: {
          'user[login]': {
            required: '请输入您的用户名'
          },
          'user[password]': {
            required: '请输入您的密码',
            minlength: '密码长度不能少于5位'
          }
        }
      });